}
}
+ // "wpExtraQueryRedirect" is a hidden input to modify
+ // after save URL and is not used by actual edit form
+ $request = RequestContext::getMain()->getRequest();
+ $extraQueryRedirect = $request->getVal( 'wpExtraQueryRedirect' );
+
switch ( $status->value ) {
case self::AS_HOOK_ERROR_EXPECTED:
case self::AS_CONTENT_TOO_BIG:
case self::AS_SUCCESS_NEW_ARTICLE:
$query = $resultDetails['redirect'] ? 'redirect=no' : '';
+ if ( $extraQueryRedirect ) {
+ if ( $query === '' ) {
+ $query = $extraQueryRedirect;
+ } else {
+ $query = $query . '&' . $extraQueryRedirect;
+ }
+ }
$anchor = isset( $resultDetails['sectionanchor'] ) ? $resultDetails['sectionanchor'] : '';
$wgOut->redirect( $this->mTitle->getFullURL( $query ) . $anchor );
return false;
$extraQuery = 'redirect=no&' . $extraQuery;
}
}
+ if ( $extraQueryRedirect ) {
+ if ( $extraQuery === '' ) {
+ $extraQuery = $extraQueryRedirect;
+ } else {
+ $extraQuery = $extraQuery . '&' . $extraQueryRedirect;
+ }
+ }
+
$wgOut->redirect( $this->mTitle->getFullURL( $extraQuery ) . $sectionanchor );
return false;
* WARNING: do not use this function on arbitrary user-supplied titles!
* On heavily-used templates it will max out the memory.
*
- * @param array $options May be FOR UPDATE
+ * @param array $options Query option to Database::select()
* @return Title[] Array of Title the Title objects linking here
*/
public function getTemplateLinksTo( $options = [] ) {
* WARNING: do not use this function on arbitrary user-supplied titles!
* On heavily-used templates it will max out the memory.
*
- * @param array $options May be FOR UPDATE
+ * @param array $options Query option to Database::select()
* @param string $table Table name
* @param string $prefix Fields prefix
* @return array Array of Title objects linking here
return [];
}
- if ( count( $options ) > 0 ) {
- $db = wfGetDB( DB_MASTER );
- } else {
- $db = wfGetDB( DB_SLAVE );
- }
+ $db = wfGetDB( DB_SLAVE );
$blNamespace = "{$prefix}_namespace";
$blTitle = "{$prefix}_title";
$table, $var, $cond = '', $fname = __METHOD__, $options = [], $join_conds = []
) {
if ( $var === '*' ) { // sanity
- throw new DBUnexpectedError( $this, "Cannot use a * field: got '$var'" );
+ throw new DBUnexpectedError( $this, "Cannot use a * field" );
+ } elseif ( !is_string( $var ) ) { // sanity
+ throw new DBUnexpectedError( $this, "Cannot use an array of fields" );
}
if ( !is_array( $options ) ) {
$url = $match['file'] . $match['query'];
$file = $local . $match['file'];
if (
- !CSSMin::isRemoteUrl( $url ) && !CSSMin::isLocalUrl( $url )
+ !self::isRemoteUrl( $url ) && !self::isLocalUrl( $url )
&& file_exists( $file )
) {
$mimeTypes[ CSSMin::getMimeType( $file ) ] = true;
/**
* Is this CSS rule referencing a remote URL?
*
- * @private Until we require PHP 5.5 and we can access self:: from closures.
* @param string $maybeUrl
* @return bool
*/
- public static function isRemoteUrl( $maybeUrl ) {
+ protected static function isRemoteUrl( $maybeUrl ) {
if ( substr( $maybeUrl, 0, 2 ) === '//' || parse_url( $maybeUrl, PHP_URL_SCHEME ) ) {
return true;
}
/**
* Is this CSS rule referencing a local URL?
*
- * @private Until we require PHP 5.5 and we can access self:: from closures.
* @param string $maybeUrl
* @return bool
*/
- public static function isLocalUrl( $maybeUrl ) {
+ protected static function isLocalUrl( $maybeUrl ) {
if ( $maybeUrl !== '' && $maybeUrl[0] === '/' && !self::isRemoteUrl( $maybeUrl ) ) {
return true;
}
* @cover CSSMin::isRemoteUrl
*/
public function testIsRemoteUrl( $expect, $url ) {
- $this->assertEquals( CSSMin::isRemoteUrl( $url ), $expect );
+ $this->assertEquals( CSSMinTestable::isRemoteUrl( $url ), $expect );
}
public static function provideIsLocalUrls() {
* @cover CSSMin::isLocalUrl
*/
public function testIsLocalUrl( $expect, $url ) {
- $this->assertEquals( CSSMin::isLocalUrl( $url ), $expect );
+ $this->assertEquals( CSSMinTestable::isLocalUrl( $url ), $expect );
}
public static function provideRemapRemappingCases() {
];
}
}
+
+class CSSMinTestable extends CSSMin {
+ // Make some protected methods public
+ public static function isRemoteUrl( $maybeUrl ) {
+ return parent::isRemoteUrl( $maybeUrl );
+ }
+ public static function isLocalUrl( $maybeUrl ) {
+ return parent::isLocalUrl( $maybeUrl );
+ }
+}